// run: $exec < input
#include <iostream>
#include <string>

int n;

std::string get(int n)
{
	if (n == 0) return "+!![]";
	if (n == 1) return "+!![]+[+[]]";
	std::string s = "[+[]]";
	for (int i = 1; i < n; i++) s = s + "+[+[]]";
	s = "+!![]+" + s;
	return s;
}

int main()
{
	std::ios::sync_with_stdio(false);
	int T; std::cin >> T;

//	for (int i = 0; i < 10; i++) std::cout << "i = " << i << "\n" << get(i) << '\n';
	while (T--) {
	//for (int i = 0; i <= 20; i++) {
		std::cin >> n;
	//	n = i;
		if (n == 0) { std::cout << "+!![]\n"; continue; }
		if (n == 1) { std::cout << "+[+!![]+[+[]]]\n"; continue; }
		std::string s = get(n);
		s = "+[" + s + "]";
		for (int j = 1; j < n; j++) {
			std::string tmp = get(j) + "*" + get(n - j);
			if (tmp.size() < s.size()) s = tmp;
		}
		//std::cout << "i = " << i << "  " << s.size() << '\n';
		std::cout << s << '\n';
	}
}

